package com.baor.controller;

import com.baor.domain.CycleVo;
import com.baor.service.RewardService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/reward")
public class RewardController {

    @Autowired
    private RewardService rewardService;

    @RequestMapping("/addConf")
    public AjaxResult<?> addConf(@RequestBody Map<String, Object> params) {
        return rewardService.addConf(params);
    }

    @RequestMapping("/cycleList")
    public AjaxResult<?> cycleList(@RequestBody Map<String, Object> params) {
        return rewardService.cycleList(params);
    }

    @RequestMapping("/search")
    public AjaxResult<?> search(@RequestBody Map<String, Object> params) {
        return rewardService.cycleList(params);
    }

    @RequestMapping("checkDetails")
    public AjaxResult<?> addReward(@RequestBody Map<String, Object> param) {
        return rewardService.checkDetails(param);
    }

    @RequestMapping("grant")
    public AjaxResult<?> grant(@RequestBody CycleVo vo) {
        return rewardService.grant(vo.getCycleId());
    }


}
